<?php

class Core_Model_Customer_Collection_Product extends Dcmp_Model_Collection_Strong {

    public function __construct() {
        parent::__construct();
        $this->setItemClass('customer/product');
        $this->from('{t}customer_product', 'a')->field('a.*');
    }

    public function joinAccount(){
        return $this->innerJoin('{t}permission_account', 'b', 'a.creator_id', 'b.id')
                    ->field('b.full_name', 'creator');
    }

    public function filterBy($name, $arg) {
        switch ($name) {
            case 'poiid':
                return $this->eq('a.poi_id', ':poiId:s')->addParameter('poiId', $arg);
            case 'status':
                return $this->eq('a.status', ':status:s')->addParameter('status', $arg);
        }
        return $this;
    }

}